package com.dankegongyu.lib.list

import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import com.dankegongyu.lib.R
import com.dankegongyu.lib.common.widget.HorizontalWrappedListView

/**
 * @author wupuquan
 * @version 1.0
 * @since 2020/4/21 12:15
 */
class HorizontalListAdapter(data: MutableList<String>?) : HorizontalWrappedListView.Adapter<String>(data) {

    override fun getItem(parent: HorizontalWrappedListView, position: Int, itemData: String): HorizontalWrappedListView.Item {
        val view = View.inflate(parent.context, R.layout.cell_wrap_linearlistlayout_item, null)
        val contentView = view.findViewById<LinearLayout>(R.id.contentView)
        val tvContent = view.findViewById<TextView>(R.id.tv_item)
        val dividerView = view.findViewById<View>(R.id.dividerView)

        tvContent.text = itemData
        return HorizontalWrappedListView.Item(contentView, dividerView)
    }

}